# -*- coding: utf-8 -*-

# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html


# class BiqugePipeline(object):
#     def __init__(self):
#         self.f = open("./bqg.txt", "w")
#
#     def process_item(self, item, spider):
#         self.f.write(str(item) + "\n")
#         return item
#
#     def __del__(self):
#         self.f.close()


class BiqugePipeline(object):
    def __init__(self):
        self.f = open("./data.csv", "w", encoding="utf-8")

    def process_item(self, item, spider):
        self.f.write(str(item) + "\n")
        self.f.flush()
        return item

    def __del__(self):
        self.f.close()